#pragma once

#include<math.h>

class Point
{
public:
	int X;
	int Y;
	//--
	Point(const int& x , const int& y)
	{
		X = x;
		Y = y;
	}
	Point()
		:X(0),
		Y(0)
	{
	}
	inline float DistanceTo(const Point& anotherPoint) const
	{
		float dx = anotherPoint.X - X;
		float dy = anotherPoint.Y - Y;
		return sqrtf(dx * dx + dy * dy);
	}
	inline int ApproximateDistanceMultiply10000(const Point& anotherPoint) const
	{
		int dx(anotherPoint.X - X);
		if(dx < 0)
		{
			dx = -dx;
		}
		int dy(anotherPoint.Y - Y);
		if(dy < 0)
		{
			dy = -dy;
		}
		if(dx > dy)
		{
			return 10000 * (dx - dy) + dy * 14142;
		}
		else
		{
			return 10000 * (dy - dx) + dx * 14142;
		}
	}
	inline void Set(const int x , const int& y)
	{
		X = x;
		Y = y;
	}
	inline void operator=(const Point& anotherPoint)
	{
		X = anotherPoint.X;
		Y = anotherPoint.Y;
	}
	inline bool operator==(const Point& anotherPoint) const
	{
		return X == anotherPoint.X && Y == anotherPoint.Y;
	}
	inline operator size_t() const
	{
		return (X << 5) ^ Y;
	}
};